
import { getSysConfigApi } from '@/api/app';
import { keyBy } from 'lodash-es'


const state = {
  config: {}
}
const getters = {
}

const actions = {
  async getSysConfig({ commit, dispatch }) {
    const data = await getSysConfigApi();
    commit('setSysConfig', keyBy(data, 'code'))
  },
}
const mutations = {
  setSysConfig(state, data) {
    console.log('data', data)
    state.config = data
  }
}

export default {
  namespaced: true,
  state,
  getters,
  actions,
  mutations,
}
